<template>
    <div class="container">
        <div v-show="isAllowWechat">
            <img class="mapImg" @click="toPage('pages/hotline')" src="../assets/img/moreHotline.png" />
        </div>
        <div v-show="isAllowWechat">
            <img class="mapImg" @click="toPage('pages/trans_pro')" src="../assets/img/moreTrans.png" />
        </div>
        <img class="mapImg" @click="toPage('pages/map/index')" src="../assets/img/moreMap.png" />
        <div v-show="isAllowWechat">
            <img class="mapImg" @click="toPage('pages/stat')" src="../assets/img/moreStat.png" />
        </div>
        <!-- <div class="card">
            <div class="card-bottom">
                <div class="grid-item" @click="toPage('pages/hotline')">
                    <img class="icon" src="https://tuanfeng.whkxzj.com/profile/static/20230110141921-窗口电话.png" />
                    <div class="text">窗口电话</div>
                </div>
                <div class="grid-item" @click="toPage('pages/trans_pro')">
                    <img class="icon" src="https://tuanfeng.whkxzj.com/profile/static/20230109162010-kuasheng.png" />
                    <div class="text">跨省通办</div>
                </div>
                <div class="grid-item" @click="toPage('pages/map/index')">
                    <img class="icon" src="https://tuanfeng.whkxzj.com/profile/static/20230109162144-guide.png" />
                    <div class="text">政务服务地图</div>
                </div>
                <div v-show="isAllowWechat" style="width: 25%;">
                    <div class="grid-item" style="width: 100%;" @click="toPage('pages/stat')">
                        <img class="icon" src="https://tuanfeng.whkxzj.com/profile/static/20230109162300-stat.png" />
                        <div class="text">政务驾驶舱</div>
                    </div>
                </div>
            </div>
        </div> -->
    </div>
</template>
<script>
import { mapState } from "vuex";
import { getStatRoleAPI } from "../api/stat";

export default {
    data() {
        return {
            isAllowWechat: false,
        };
    },
    onShareAppMessage() {},
    onShow() {},
    computed: {
        ...mapState(["openId"]),
    },
    mounted() {
        if (this.openId) {
            getStatRoleAPI().then((resp) => {
                const data = resp.data;
                if (data) {
                    const openIds = data.map((item) => item.openId);
                    if (openIds.includes(this.openId)) {
                        this.isAllowWechat = true;
                    }
                }
            })
        }
    },
    methods: {
        toPage(url, params) {
            this.$u.route({
                url,
                params,
            });
        },
    },
};
</script>
<style scoped lang="scss">
@import "../assets/scss/common.scss";

.container {
    min-height: 100vh;
    background-color: #fafafa;
    box-sizing: border-box;
    padding: 15px;
    .mapImg {
      width: 100%;
      height: 120px;
    }
    .grids {
        display: flex;
        flex-direction: column;
        border-radius: 8px;
        background-color: #fff;
        margin-bottom: 15px;
        box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1) !important;
        .grids-title {
            padding: 15px 15px 8px;
            border-bottom: 1px solid #efefef;
            font-size: 18px;
            font-weight: bold;
        }
        .grids-content {
            display: flex;
            flex-wrap: wrap;
            padding: 15px;
            .grid {
                width: 25%;
                display: flex;
                flex-direction: column;
                align-items: center;
                .icon {
                    width: 50px;
                    height: 50px;
                    margin-bottom: 5px;
                }
                .text {
                    text-align: center;
                    font-size: 13px;
                }
            }
        }
    }
    .card {
        padding: 15px 0;
        border-radius: 8px;
        background-color: #fff;
        margin-bottom: 15px;
        box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1) !important;
        .card-header {
            padding: 0 15px 8px;
            border-bottom: 1px solid #efefef;
            margin-bottom: 12px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            .card-title {
                font-size: 18px;
                font-weight: bold;
                display: flex;
                align-items: center;
                img {
                    width: 5px;
                    height: 18px;
                    margin-right: 10px;
                }
            }
        }
        .card-bottom{
            display: flex;
            align-items: center;
            padding: 0 15px;
            .grid-item{
                width: 25%;
                display: flex;
                flex-direction: column;
                align-items: center;
                .icon{
                    width: 45px;
                    height: 45px;
                    margin-bottom: 5px;
                }
                .text{
                    font-size: 13px;
                }
            }
        }
    }
}
</style>

